/*
File Name: RxProc.h
Description: Prototype description of Rx Processing
*/
#ifndef RXPROC_H
#define RXPROC_H
#ifdef __cplusplus
extern "C"
{
#endif ///__cplusplus

/*
Data structure to initialize the RxParam
*/
typedef struct _rx_init
{
	PMRVDRV_ADAPTER	pAdapter;
	NDIS_HANDLE		MrvDrvAdapterHdl;
	
} RXINIT, *PRXINIT;

typedef enum _GET_PACKET_STATUS
{
    GPS_SUCCESS = 0,    // get packet was successful
    GPS_RESOURCE,       // get packet was successful, but number of free packet is low
    GPS_FAILED          // unable to get packet
} MRVDRV_GET_PACKET_STATUS;

// for packet Q
typedef struct _PacketQueueNode
{
    struct _PacketQueueNode     *Next;

    PUCHAR                      pRxBufVM;
    PNDIS_PACKET                pPacket[RxPKTAggreCnt];
    PNDIS_BUFFER                pRxBuffer[RxPKTAggreCnt];
    BOOLEAN                     AvailablePkt[RxPKTAggreCnt];
    PRxPD                       pRxPd[RxPKTAggreCnt];
    USHORT                      UsedPkt;
} PACKET_QUEUE_NODE, *PPACKET_QUEUE_NODE;


/* ========================================================================= */
///Init/Deinit interface
NDIS_STATUS InitRxParam(IN PPVOID, IN PRXINIT);
NDIS_STATUS	DeinitRxParam(IN PVOID);

//VOID SetCurrentPkt(IN PVOID, PNDIS_PACKET);
VOID SetCurrentPkt(IN PVOID, IN PPACKET_QUEUE_NODE pRxNode);
VOID SetRxPd(IN PVOID, IN PRxPD);
//PNDIS_PACKET GetRxPendPkt(IN PVOID);
VOID IndicateRxPkt(IN PVOID);
SHORT GetRxPendPktcnt(IN PVOID);
__inline VOID ReturnRxPacketDesc(IN PVOID, IN PNDIS_PACKET);
__inline extern MRVDRV_GET_PACKET_STATUS GetRxPacketDesc(IN PVOID, IN PNDIS_PACKET* );

VOID ResetRxPDQ(IN PVOID);
VOID HandleRxReadyEvent(IN PVOID);
//VOID SetRxSize(IN PVOID, IN ULONG);
//ULONG GetRxSize(IN PVOID);
BOOLEAN	IsPktPending(IN PVOID);
//PNDIS_PACKET GetRxCurPkt(IN PVOID);
//VOID SetPktPendingFlag(IN PVOID, IN BOOLEAN);

VOID RxCheckForHang(IN PVOID);

__inline
extern PPACKET_QUEUE_NODE
GetRxNode(IN PVOID ipRxParam);
VOID
ReturnRxPacketNode(IN PVOID ipRxParam,
                   PPACKET_QUEUE_NODE  pPacketNode);
PUCHAR UpdateRxNodePacket(IN PVOID ipRxParam, IN PPACKET_QUEUE_NODE pRxNode);

#ifdef __cplusplus
}
#endif ///__cplusplus
#endif ///RXPROC_H


